<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // Array.prototype.map
        // let arr = [1,3,5,7];

        // let newArr = arr.map((value, index) => {
        //     return value * 100
        // });

        // let newArr = arr.map(item => item * 100);

        // console.log(newArr);

        //Array.prototype.filter  filter 过滤
        let arr = [1,4,6,10,21,345];

        //用偶数形成一个新数组
        // let newArr = arr.filter(item => {
        //     if(item % 2 === 0){
        //         return true;
        //     }else{
        //         return false;
        //     }
        // });

        let newArr = arr.filter(item => item % 2 === 0);

        console.log(newArr);


    </script>
</body>
</html>